package org.gd136.ce.script.impl;

import org.gd136.ce.script.Script;
import org.gd136.ce.script.ScriptStage;

public class TxtScript extends Script {

	String name;
	String text;

	@Override
	public Script readScript(String scriptLine) {
		TxtScript ts = new TxtScript();
		int p = scriptLine.indexOf(':');
		if (p > 0) {
			ts.name = scriptLine.substring(0, p);
			ts.text = scriptLine.substring(p + 1);
		} else {
			ts.text = scriptLine;
		}
		ts.addToPoolAndLinkFrontScript();
		return ts;
	}

	@Override
	public void execute(ScriptStage stage) {
		stage.text(name, text);
	}

}
